package com.crm.common.crm.constant;

import com.crm.common.utils.StringUtils;

/**
 * @author zhangzhiwei
 * crm模块枚举
 */

public enum CrmEnum {
    /**
     * 学员
     */
    CUSTOMER(2, "学员"),
    /**
     * 线索
     */
    LEADS(1, "线索"),
    /**
     * 联系人
     */
    CONTACTS(3, "联系人"),
    /**
     * 产品
     */
    PRODUCT(4, "产品"),
    /**
     * 商机
     */
    BUSINESS(5, "商机"),
    /**
     * 合同
     */
    CONTRACT(6, "合同"),
    /**
     * 回款
     */
    RECEIVABLES(7, "回款"),
    /**
     * 回款计划
     */
    RECEIVABLES_PLAN(8, "回款计划"),
    /**
     * 公海
     */
    CUSTOMER_POOL(9, "公海"),
    /**
     * 市场活动
     */
    MARKETING(10, "市场活动"),
    /**
     * 回访
     */
    RETURN_VISIT(17, "学员回访"),
    /**
     * 发票
     */
    INVOICE(18, "发票"),
    /**
     * VIP学员
     */
    STUDENT(19, "VIP学员"),
    /**
     * ROI投放统计
     */
    ROI_STATISTICS(20, "ROI投放统计"),
    /**
     * 智能对照工具表
     */
    COMPARISON_EXCEL(21, "智能对照工具表"),

    /**
     * 设置模块
     */
    RMLEADSSET(22, "设置模块"),

    /**
     * 加盟商充值
     */
    ALLIANCE_BUSINESS(23, "加盟商充值"),
    /**
     * 退款
     */
    REFUND(25,"退款"),

    /**
     * 账单池
     */
    ORDER_POOL(26,"账单池"),

    ROI_PUTIN(27,"ROI消耗"),

    /**
     * 协议签署记录
     */
    AGREEMENT(28,"协议签署记录")
    ;





    CrmEnum(Integer type, String remarks) {
        this.type = type;
        this.remarks = remarks;
    }

    private Integer type;
    private String remarks;

    public String getRemarks() {
        return remarks;
    }

    public static CrmEnum parse(Integer type) {
        for (CrmEnum crmEnum : CrmEnum.values()) {
            if (crmEnum.getType().equals(type)) {
                return crmEnum;
            }
        }
        return null;
    }

    public Integer getType() {
        return type;
    }

    public static CrmEnum parse(String name) {
        for (CrmEnum crmEnum : CrmEnum.values()) {
            if (crmEnum.name().equals(name)) {
                return crmEnum;
            }
        }
        return null;
    }

    public String getIndex() {
//        return "bill_single_" + name().toLowerCase()+"_"+ OrgIdThreadLocal.getOrgId();
//        if(StringUtils.isBlank(OrgIdThreadLocal.getOrgId())){
//            return "bill_single_" + name().toLowerCase();
//        }
        return "bill_single_" + name().toLowerCase();
    }

    public String getTable() {
        return name().toLowerCase();
    }

    @Override
    public String toString() {
        return this.type.toString();
    }

    public static boolean exclude(CrmEnum value) {
        if (!value.equals(CrmEnum.RECEIVABLES_PLAN)
                && !value.equals(CrmEnum.CUSTOMER_POOL)
                && !value.equals(CrmEnum.MARKETING)
                && !value.equals(CrmEnum.INVOICE)
                && !value.equals(CrmEnum.ROI_STATISTICS)
                && !value.equals(CrmEnum.COMPARISON_EXCEL)
                && !value.equals(CrmEnum.ALLIANCE_BUSINESS)
                && !value.equals(CrmEnum.ORDER_POOL)
                && !value.equals(CrmEnum.RMLEADSSET)
                && !value.equals(CrmEnum.ROI_PUTIN)) {
            return true;
        }
        return false;
    }

}
